package server.config;

import server.HttpServlet;

import java.io.InputStream;

/**
 * 记录Service信息
 */
public class Service {
    /**
     * 连接器配置对象
     */
    private Connector connector;

    /**
     * 执行引擎
     */
    private Engine engine;

    /**
     * 根据给定的URL，获取对应的Servlet
     *
     * @param url 给定的URL
     * @return 对应的Servlet
     */
    public HttpServlet resolveServlet(String url) {
        return engine.resolveServlet(url);
    }

    /**
     * 根据给定的URL，获取对应的静态资源
     *
     * @param url 给定的URL
     * @return 对应的静态资源
     */
    public InputStream resolveStatic(String url) {
        return engine.resolveStatic(url);
    }

    public Connector getConnector() {
        return connector;
    }

    public void setConnector(Connector connector) {
        this.connector = connector;
    }

    public Engine getEngine() {
        return engine;
    }

    public void setEngine(Engine engine) {
        this.engine = engine;
    }
}
